import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
} from '@nestjs/common';
import { ClassificationService } from './classification.service';

@Controller('classification')
export class ClassificationController {
  constructor(private readonly classificationService: ClassificationService) {}

  @Post()
  create(@Body() createData) {
    return this.classificationService.create(createData);
  }

  @Post('list')
  findAll(@Body() createData) {
    return this.classificationService.findAll({ ...createData });
  }

  @Get(':id')
  findOne(@Param('id') id: number) {
    return this.classificationService.findOne({ id });
  }

  @Patch(':id')
  update(@Param('id') id: number, @Body() updateData) {
    return this.classificationService.update({
      where: { id: +id },
      data: updateData,
    });
  }

  @Delete(':id')
  remove(@Param('id') id: number) {
    return this.classificationService.delete({ id });
  }
}
